package eu.vranckaert.vvl.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import eu.vranckaert.vvl.R;
import eu.vranckaert.vvl.activities.preferences.PreferenceActivity;
import eu.vranckaert.vvl.activities.trafficinfo.TrafficInfoGraphicalActivity;
import eu.vranckaert.vvl.activities.trafficinfo.TrafficInfoTextActivity;

public class DashboardActivity extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dashboard);

        startAlarms();
    }

    /**
     * All alarms are killed when the application is 'forced stopped'. That's why we will try to (re)start the alarms
     * every time the user opens the application (for the first time or after a force stop...).
     */
    public void startAlarms() {
        Intent startAlarmsIntent = new Intent("eu.vranckaert.vvl.launchAllAlarms");
        sendBroadcast(startAlarmsIntent);
    }

    public void onClickTrafficInfoText(View view) {
        Intent intent = new Intent(DashboardActivity.this, TrafficInfoTextActivity.class);
        startActivity(intent);
    }

    public void onClickTrafficInfoGraphical(View view) {
        Intent intent = new Intent(DashboardActivity.this, TrafficInfoGraphicalActivity.class);
        startActivity(intent);
    }

    public void onClickPreferences(View view) {
        Intent intent = new Intent(DashboardActivity.this, PreferenceActivity.class);
        startActivity(intent);
    }
}
